﻿using System;
using Game;

namespace ApiToolkit
{
	// Token: 0x0200000E RID: 14
	public abstract class PropertyEditor : IPropertyEditor
	{
		// Token: 0x17000004 RID: 4
		// (get) Token: 0x06000025 RID: 37
		internal abstract PropertyEditor.IPropertyBehavior PropertyBehavior { get; }

		// Token: 0x17000005 RID: 5
		// (get) Token: 0x06000026 RID: 38 RVA: 0x00002D0A File Offset: 0x00000F0A
		// (set) Token: 0x06000027 RID: 39 RVA: 0x00002D12 File Offset: 0x00000F12
		public int TargetBlockID
		{
			get
			{
				return this.targetBlockID;
			}
			set
			{
				this.targetBlockID = value;
			}
		}

		// Token: 0x17000006 RID: 6
		// (get) Token: 0x06000028 RID: 40 RVA: 0x00002D1B File Offset: 0x00000F1B
		// (set) Token: 0x06000029 RID: 41 RVA: 0x00002D23 File Offset: 0x00000F23
		public string TargetPropertyName { get; internal set; }

		// Token: 0x17000007 RID: 7
		// (get) Token: 0x0600002A RID: 42 RVA: 0x00002D2C File Offset: 0x00000F2C
		// (set) Token: 0x0600002B RID: 43 RVA: 0x00002D60 File Offset: 0x00000F60
		public object TargetPropertyValue
		{
			get
			{
				Block block = BlocksManager.Blocks[this.TargetBlockID];
				return block.GetType().GetField(this.TargetPropertyName).GetValue(block);
			}
			set
			{
				Block block = BlocksManager.Blocks[this.TargetBlockID];
				block.GetType().GetField(this.TargetPropertyName).SetValue(block, value);
			}
		}

		// Token: 0x0600002C RID: 44 RVA: 0x00002D92 File Offset: 0x00000F92
		public virtual void Apply(object value)
		{
			this.TargetPropertyValue = value;
		}

		// Token: 0x0600002D RID: 45 RVA: 0x00002D9B File Offset: 0x00000F9B
		public PropertyEditor(int content, string targetProperty)
		{
			this.TargetBlockID = content;
			this.TargetPropertyName = targetProperty;
		}

		// Token: 0x0400002A RID: 42
		private int targetBlockID;

		// Token: 0x02000014 RID: 20
		public interface IPropertyBehavior
		{
			// Token: 0x0600003C RID: 60
			ApplyStatus Apply(PropertyEditor editor, object value);
		}

		// Token: 0x02000015 RID: 21
		public class DefaultBehavior : PropertyEditor.IPropertyBehavior
		{
			// Token: 0x0600003D RID: 61 RVA: 0x00002FA8 File Offset: 0x000011A8
			public ApplyStatus Apply(PropertyEditor editor, object value)
			{
				editor.TargetPropertyValue = value;
				return ApplyStatus.Succeed;
			}
		}
	}
}
